home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
026-050
/
scopedisk46
/
mj-pgs
/
mj.gen_t
< prev
next >
Wrap
Text File
|
1995-03-18
|
7KB
|
226 lines
PRINT TAB(24)"Universal Mandel-Julia Generator"
'Martin F. Combs
'minor modifications to Basic Code by A. Wachtel
'The program is converted from floating point to integer by scaling up
'by a factor of 2^28, which gives approximately the precision of single
'precision floating point, but is a lot faster. All multiplications are
'followed by dividing by the scale factor. An ASCII file of the assembly
'language program can be viewed by entering the CLI and using
'type juliasize.asc
start:CLEAR ,40000&,10000
width77:DEFINT h,j-l,n,v:DEFLNG m,p,s:DEFDBL c,i,r,t:DIM para(100)
scale=268435456&:DEF FNa(x)=INT(x*10000000&+.5)/10000000&
PRINT "Iterations are terminated when x^2+y^2>4.
INPUT "max. size (*scale - use power of 2 =< 4096)";jsizelimit
para(98)=30-LOG(jsizelimit+1)/LOG(2)
type: INPUT "Enter j for Julia Set, m for Mandelbrot Set ",typeflag$
IF typeflag$="j" THEN
title$="Julia":offset=98
INPUT "is this for a symmetric plot (y/n)";w$:GOTO carryon
END IF
IF typeflag$="m" THEN title$="Mandelbrot" ELSE GOTO type
carryon:
DIM n(6100),jcolors(6100),br(15)
PRINT "# of horizontal pixels calc'd"
PRINT " (max=632 write or 312 plot)";
IF w$="y" THEN PRINT " -use an even number";
INPUT horpix: IF w$="y" THEN hor=horpix/2-1 ELSE hor=horpix-1
INPUT "# of vertical pixels (max=387 write or 187 plot)";verpix
IF typeflag$="m" THEN jumparound
INPUT "Real part of c";creal:para(1)=scale*creal
INPUT "Imaginary part of c";cimag:para(2)=scale*cimag
jumparound:
INPUT "Real left limit";realleft
INPUT "Real right limit";realright:realrange=realright-realleft
INPUT "Imaginary Lower Limit";imaglow
INPUT "Imaginary Upper Limit ";imaghigh:imagrange=imaghigh-imaglow
rstepreal=realrange*scale/horpix :stepreal=rstepreal
stepimag=imagrange*scale/verpix
PRINT "Horizontal step size should be ";rstepreal;" and is ";stepreal
PRINT "Vertical stepsize =";stepimag
para(1+offset)=scale*realleft
scaleimaglow=scale*imaglow
p1=para(1):p2=para(2):p99=para(99):p100=para(100)
INPUT"do you want to plot or write files (p/w)";mode$
replot:INPUT"highest iter.count";para(0)
INPUT"lowest count in region (est'd)";ja
IF mode$="p" THEN continue
INPUT"name of region to be explored (include path)";region$
count$=region$+".count_B"
stat$=region$+".stat_D"
inform$=region$+".inform_D"
OPEN "O",#1,count$,3000&
PRINT:PRINT TAB(13)"Number Crunching - please blank screen and be patient."
GOTO MLcode
continue:
IF w$<>"y" THEN GOSUB breakpoints
PRINT"TO CLEAR PLOT SCREEN OR RERUN PROGRAM, PRESS <RETURN>"
PRINT "press any key to continue":WHILE INKEY$="":WEND
para(1)=p1:para(2)=p2:para(99)=p99:para(100)=p100
SCREEN 3,320,200,4,1:WINDOW 2,title$,,0,3
CLS:GOSUB newcolor
MLcode:
j=0:k=0:l=0:t=TIMER
startcode=VARPTR(para(25))
again: READ j
IF j=999 THEN quit
POKE startcode+k,j
k=k+1:GOTO again
quit:
RESTORE
IF mode$="p" GOTO plot
IF typeflag$="j" THEN
FOR j=0 TO hor
para(99)=para(99)+stepreal
para(100)=scaleimaglow
FOR k=0 TO verpix-1
para(100)=para(100)+stepimag
CALL startcode
l=para(3)
n(l)=n(l)+1
PRINT #1,MKI$(l);
NEXT:NEXT
ELSE
FOR j=0 TO hor
para(1)=para(1)+stepreal
para(2)=scaleimaglow
FOR k=0 TO verpix-1
para(2)=para(2)+stepimag
CALL startcode
l=para(3)
n(l)=n(l)+1
PRINT #1,MKI$(l);
NEXT:NEXT
END IF
CLOSE#1
OPEN "O",#2,stat$
FOR l=1 TO para(0)+jsizelimit:WRITE#2,n(l):NEXT
CLOSE#2
OPEN "O",#3,inform$
PRINT#3,region$
WRITE#3,horpix,verpix,w$,typeflag$
WRITE#3,ja,para(0),jsizelimit
PRINT#3,"The above data are for reading by a plot or other program"
PRINT#3,"and represent the following:"
PRINT#3,"# of horiz.pixels, # of vert. pixels, 'y'=symmetric"
PRINT#3,"min.count, max.count (limit), size^2=4 expanded to this #,"
PRINT#3,"type (m = Mandelbrot, j = Julia Set)"
PRINT#3,""
PRINT#3,"The data below are for general reference only:"
IF typeflag$="j" THEN PRINT#3,"Julia set" ELSE PRINT#3,"Mandelbrot"
IF w$="y" THEN PRINT#3,"symmetric"
PRINT#3,"real left and right limits are: ";FNa(realleft);" ";FNa(realright)
PRINT#3,"imag.lower and upper limits are: ";FNa(imaglow);" ";FNa(imaghigh)
IF typeflag$="j" THEN PRINT#3,"real and imag. values of c are: ";FNa(creal);" ";FNa(cimag)
CLOSE#3
finish: ti=TIMER-t
ah=ti/3600:am=(ah-INT(ah))*60:bs=(am-INT(am))*60
PRINT "time="INT(ah)":"INT(am)":"CINT(bs)
WHILE INKEY$<>CHR$(13):WEND
SCREEN CLOSE 3:WINDOW CLOSE 2
INPUT"type a1 to replot the same area or a2 to rerun pgm";again$
IF again$="a1" THEN CLS:GOTO replot
IF again$="a2" THEN CLS:GOTO start
END
plot:
IF typeflag$="j" THEN
IF w$="y" THEN GOTO symplot
FOR j=0 TO hor
para(99)=para(99)+stepreal
para(100)=scaleimaglow
FOR k=0 TO verpix-1
para(100)=para(100)+stepimag
CALL startcode
PSET (j,verpix-1-k),jcolors(para(3))
NEXT:NEXT
ELSE
FOR j=0 TO hor
para(1)=para(1)+stepreal
para(2)=scaleimaglow
FOR k=0 TO verpix-1
para(2)=para(2)+stepimag
CALL startcode
PSET (j,verpix-1-k),jcolors(para(3))
NEXT:NEXT
END IF
GOTO finish
symplot:
FOR j=0 TO hor
para(99)=para(99)+stepreal
para(100)=scaleimaglow
FOR k=0 TO verpix-1
para(100)=para(100)+stepimag
CALL startcode
PSET (j,verpix-1-k),para(3) MOD 16
PSET (horpix-1-j,k),para(3) MOD 16
NEXT:NEXT
GOTO finish
newcolor:
PALETTE 0,0,0,0 'black
PALETTE 1,1,1,1 'white
PALETTE 2,1,1,0 'yellow
PALETTE 3,.67,.87,0
PALETTE 4,0,1,0
PALETTE 5,0,.8,.47 'green
PALETTE 6,0,.53,.67
PALETTE 7,0,.4,.8
PALETTE 8,0,.2,1 'blue
PALETTE 9,.53,0,1
PALETTE 10,.73,0,.8
PALETTE 11,1,0,.73 'purple
PALETTE 12,1,.4,.6
PALETTE 13,1,.53,.6 'pink
PALETTE 14,1,.67,.8
PALETTE 15,1,1,1 'white
RETURN
breakpoints:
n=15:jb=para(0)-ja:PRINT "breakpoints are:"
d=EXP(LOG(jb)/(n-1)):br(1)=1:FOR j=2 TO n:br(j)=br(j-1)*d:NEXT
FOR j=1 TO n-1:br(j)=CINT(ja+br(j)):IF br(j)<=br(j-1) THEN br(j)=br(j-1)+1
PRINT br(j);:NEXT:br(n)=para(0)-1:PRINT br(n)
jj=1:FOR j=1 TO para(0)+jsizelimit-1:jcolors(j)=jj
IF j=br(jj) THEN jj=jj+1
NEXT
RETURN
DATA 72,231,255,255,75,250,255,150
DATA 32,45,1,140,40,45,1,144,32,124
DATA 0,0,0,0,34,109,0,4,36,109
DATA 0,8,96,94,82,72,158,142,222,137
DATA 118,0,43,64,0,16,106,6,118,1
DATA 68,173,0,16,43,68,0,20,106,6
DATA 82,131,68,173,0,20,50,45,0,16
DATA 194,237,0,22,52,45,0,18,196,237
DATA 0,20,210,130,124,11,236,169,52,45
DATA 0,18,196,237,0,22,124,27,236,170
DATA 210,130,52,45,0,16,196,237,0,20
DATA 235,138,210,130,12,3,0,1,102,2
DATA 68,129,210,138,40,1,32,7,118,0
DATA 43,64,0,16,97,44,74,3,102,30
DATA 46,1,43,68,0,16,97,32,74,3
DATA 102,18,44,65,210,135,177,213,103,74
DATA 178,188,64,0,0,0,107,0,255,122
DATA 43,72,0,12,76,223,255,255,78,117
DATA 106,4,68,173,0,16,50,45,0,18
DATA 194,237,0,18,124,28,236,169,52,45
DATA 0,16,196,237,0,18,124,11,236,170
DATA 210,130,52,45,0,16,196,237,0,16
DATA 180,188,4,0,0,0,90,195,233,138
DATA 210,130,78,117,178,188,64,0,0,0
DATA 108,184,38,45,1,136,230,169,209,193
DATA 96,174,999